home *** CD-ROM | disk | FTP | other *** search
- // navigation.cnh
-
- // messages to page
- message NavApply();
- message NavReload();
- message NavBack();
-
- // messages from page
- message SetApply(boolx _bEnabled);
- message SetReload(boolx _bEnabled);
-
-
- func Gui_Component NewNavBar();
- func void Nav_OnClick(Gui_Component _pComponent);
- func void Nav_SetApply(boolx _bEnabled);
- func void Nav_SetReload(boolx _bEnabled);
-
-
- class Gui_dtNavBar
- {
- var Gui_Component gcApplyButton;
- var Gui_Component gcReloadButton;
- var Gui_Component gcBackButton;
- };
-
- interface Gui_iNavBar
- {
- Nav_OnClick Click;
- Nav_SetApply SetApply;
- Nav_SetReload SetReload;
- }
-
- func Gui_Component NewNavBar()
- {
- var Gui_Component composite;
- var Gui_dtNavBar pdtData;
-
- composite = NewObject(Gui_iNavBar);
- pdtData = new Gui_dtNavBar;
- SetData(composite, pdtData);
-
- var i32x iPositionX, iSpaceX;
- iPositionX = 0;
- iSpaceX = 5;
-
- pdtData.gcApplyButton = NewButtonDyn(smBtnValid);
- MountComponent(composite, pdtData.gcApplyButton);
- iPositionX = iPositionX + SizeX(pdtData.gcApplyButton) + iSpaceX;
-
- pdtData.gcReloadButton = NewButtonDyn(smDefaultButton);
- MountComponent(composite, pdtData.gcReloadButton);
- MoveTo(pdtData.gcReloadButton, iPositionX, 0);
- iPositionX = iPositionX + SizeX(pdtData.gcReloadButton) + iSpaceX;
-
- pdtData.gcBackButton = NewButtonDyn(smLeftButton);
- MountComponent(composite, pdtData.gcBackButton);
- MoveTo(pdtData.gcBackButton, iPositionX, 0);
- iPositionX = iPositionX + SizeX(pdtData.gcBackButton);
-
- StretchTo(composite, iPositionX, SizeY(pdtData.gcApplyButton));
- return composite;
- }
-
- func void Nav_OnClick(Gui_Component _pComponent)
- {
- var Gui_Component pthis, pparent;
- pthis = GetThis();
-
- var Gui_dtNavBar pdtData;
- pdtData = GetData(pthis);
-
- pparent = GetParent(pthis);
-
- // send message to page
- if (_pComponent==pdtData.gcApplyButton)
- {
- pparent<<NavApply();
- }
-
- if (_pComponent==pdtData.gcReloadButton)
- {
- pparent<<NavReload();
- }
-
- if (_pComponent==pdtData.gcBackButton)
- {
- pparent<<NavBack();
- }
- }
-
- //
- func void Nav_SetApply(boolx _bEnabled)
- {
- var Gui_Component pthis, pparent;
- pthis = GetThis();
-
- var Gui_dtNavBar pdtData;
- pdtData = GetData(pthis);
-
- if (_bEnabled) pdtData.gcApplyButton<<Show();
- else pdtData.gcApplyButton<<Hide();
- }
-
- //
- func void Nav_SetReload(boolx _bEnabled)
- {
- var Gui_Component pthis, pparent;
- pthis = GetThis();
-
- var Gui_dtNavBar pdtData;
- pdtData = GetData(pthis);
-
- if (_bEnabled) pdtData.gcReloadButton<<Show();
- else pdtData.gcReloadButton<<Hide();
- }